
package com.lzb.compressmaster.adapter;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.compressmaster.R;
import com.lzb.compressmaster.basic.ProviderMultiAdapter;
import com.lzb.compressmaster.basic.media.AudioBean;

public class SelAudioAdapter extends ProviderMultiAdapter<AudioBean> {

    public SelAudioAdapter() {
        addItemProvider(new SelAudioProvider());
    }

    private class SelAudioProvider extends BaseItemProvider<AudioBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_audio;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, AudioBean bean) {
            baseViewHolder.setText(R.id.tvSelAudioItemName, bean.getName());
            baseViewHolder.setText(R.id.tvSelAudioItemSize, ConvertUtils.byte2FitMemorySize(bean.getSize(), 0));
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivSelAudioItemSel, R.drawable.axuanz);
            } else {
                baseViewHolder.setImageResource(R.id.ivSelAudioItemSel, R.drawable.awxz);
            }
        }
    }


}
